<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<%@ include file="/WEB-INF/views/include/head.jsp"%>
<title>大货服装款式</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<link rel="stylesheet" href="${ctxStatic}/css/list.css">
<script src="${ctxStatic}/js/style.js"></script>
<script src="${ctxStatic}/dateCalendar/WdatePicker.js"></script>
<script>
	// 检索按钮实装方法
	function searchListForm() {
		var sOrderTypeCD = $("#orderTypeCD").val();
		var sContractNo = $("#contractNo").val();
		var sBeginDateStr = $("#beginDateStr").val();
		var sOrderProduceStatusCd = $("#orderProduceStatusCd").val();
		var sOrderStatusCD = $("#orderStatusCD").val();
		var sStyleNo = $("#styleNo").val();
		var sOrderNO = $("#orderNO").val();
		var orderByType = $("#orderByType").val();
		var sOperating3Date = $("#operating3Date").val();
		var operateId = $("#operateId").val();
		if (orderByType == "2") {
			orderByType = 1;
		}else if (orderByType == "1"){
			orderByType = 2;
		}
		$("#activity_pane").showLoading();
		$.post("${ctx}/customization/monitor/searchMonitorList?orderTypeCD="
				+ sOrderTypeCD
				+ "&contractNo=" + sContractNo 
				+ "&beginDateStr=" + sBeginDateStr
				+ "&orderProduceStatusCd=" + sOrderProduceStatusCd
				+ "&orderStatusCD=" + sOrderStatusCD
				+ "&styleNo=" + sStyleNo
				+ "&orderNO=" + sOrderNO
				+ "&orderByTerm=" + operateId
				+ "&orderByType=" + orderByType
				+ "&operating3Date=" + sOperating3Date,"", function(result) {
			var listHtml = result["monitor"];
			var pageHtml = result["page"];
			$("#listHtml").html(listHtml);
			$("#paging").html(pageHtml);
			$("#activity_pane").hideLoading();
		}, 'json');
	}

	//重置
	function clean() {
		$("input").val("");
		$("#productionNo").val('');
		$("#orderTypeCD").val('');
		$('#contractNo').val('');
		$("#customerName").val('');
		$("#beginDateStr").val('');
		$("#orderProduceStatusCd").val('');
		$("#orderStatusCD").val('');
		$("#operating3Date").val('');
		$("#styleNo").val('');
		$("#orderNO").val('');
		$("select").select2();
		$("#orderByType").val('1');
		$("#operateId").val('0');
		$("#orderImage").remove();
		searchListForm();
	}
	// 全选
	function chooseAll(item) {
		if (item.checked || item.checked == "true") {
			$("[name='ids']").prop("checked", true);
		} else {
			$("[name='ids']").prop("checked", false);//取消全选
		}
	}
	//排序 
	function orderBy(obj,operateId) {
		var oldoPerateId = $("#operateId").val();
		var updownImage;
		if (operateId != oldoPerateId) {
			$("#orderByType").val("1");
		}
		var orderByType = $("#orderByType").val();
		$("#orderImage").remove();
		if (orderByType == "2") {
			updownImage = "<img id='orderImage' src='${ctxStatic}/images/icon-imgUp.png' style='width: 20px;height: 20px;margin-right: 2px;'/>";
			$("#orderByType").val("1");
		}else {
			updownImage = "<img id='orderImage' src='${ctxStatic}/images/icon-imgDown.png' style='width: 20px;height: 20px;margin-right: 2px;'/>";
			$("#orderByType").val("2");
		}
		$("#operateId").val(operateId);
		$(obj).append(updownImage);
		//排序检索 
		/* var sProductionNo = $("#productionNo").val(); */
		var sOrderTypeCD = $("#orderTypeCD").val();
		var sContractNo = $("#contractNo").val();
		var sBeginDateStr = $("#beginDateStr").val();
		var sOrderProduceStatusCd = $("#orderProduceStatusCd").val();
		var sOrderStatusCD = $("#orderStatusCD").val();
		var sStyleNo = $("#styleNo").val();
		var sOrderNO = $("#orderNO").val();
		var sOperating3Date = $("#operating3Date").val();
		$("#activity_pane").showLoading();
		$.post("${ctx}/customization/monitor/searchMonitorList?contractNo=" + sContractNo 
				+ "&orderTypeCD=" + sOrderTypeCD
				+ "&beginDateStr=" + sBeginDateStr
				+ "&orderProduceStatusCd=" + sOrderProduceStatusCd
				+ "&orderStatusCD=" + sOrderStatusCD
				+ "&styleNo=" + sStyleNo
				+ "&orderNO=" + sOrderNO
				+ "&orderByTerm=" + operateId
				+ "&orderByType=" + orderByType
				+ "&operating3Date=" + sOperating3Date,"", function(result) {
			var listHtml = result["monitor"];
			var pageHtml = result["page"];
			$("#listHtml").html(listHtml);
			$("#paging").html(pageHtml);
			$("#activity_pane").hideLoading();
		}, 'json');
	}
</script>
<style type="text/css">
	.greenCloud{
		color: #229f24;
	}
	.grayCloud{
		color: #808080;
	}
	.redCloud{
		color: #d2322d;
	}
	.yellowCloud{
		color: #AE8F00;
	}	

</style>
</head>
<body>
	<div class="listArea" id="activity_pane">
		<c:set value="PRODUCTION_STATUS" var="productionStatus" />
		<c:set value="ORDER_STATUS" var="orderStatus" />
		<c:set value="ORDER_TYPE" var="orderType" />
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}" />
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}" />
		<input type="hidden" id="orderByType" value="1"/>
		<input type="hidden" id="operateId" value="0"/>
		<div class="listBg">
			<div class="searchArea clearfix">
				<div class="searchLeft clearfix" style="width: 1670px;">
					<div class="searchInp clearfix">
						<!-- 订单类型-->
						<p class="searchTxt">
							<spring:message code="contract_orderType" />
						</p>
						<select id="orderTypeCD" name="orderTypeCD" style="width: 100px;">
							<option value=""><spring:message code="CompanyUser_pleaseChoose" /></option>
							<c:forEach items="${fns:getDictList(orderType)}" var="item">
								<option value="${item.itemCode}-${item.itemValue}">${item.itemName}</option>
							</c:forEach>
						</select>
					</div>
					<div class="searchInp clearfix">
						<!-- 日期 -->
						<p class="searchTxt">
							<spring:message code="order_shipments_date" />
						</p>
						<div class="timeBox">
							<input type="text" class="laydate-icon"
								onclick="WdatePicker({el:this,dateFmt:'yyyy-MM-dd',onpicked:null})"
								id="beginDateStr" name="beginDateStr"
								style="width: 110px" value="<%-- ${fns:getDate('yyyy-MM-dd') } --%>">

						</div>
					</div>
					<%-- <div class="searchInp clearfix">
						<!-- 生产制单号-->
						<p class="searchTxt">
							<spring:message code="license_no" />
						</p>
						<input class="w-customer" id="productionNo" name="productionEntity.productionNo" value="${order.productionEntity.productionNo }">
					</div> --%>
					<div class="searchInp clearfix">
						<!-- 合同号 -->
						<p class="searchTxt">
							<spring:message code="contract_no" />
						</p>
						<input class="w-customer" id="contractNo" name="contractNo">
					</div>
					
					<div class="searchInp clearfix">
						<!-- 生产号 -->
						<p class="searchTxt">
							<spring:message code="style_neibu_no" />
						</p>
						<input class="w-customer" id="styleNo" name="styleNo">
					</div>
					
					<div class="searchInp clearfix">
						<!-- 订单号 -->
						<p class="searchTxt">
							<spring:message code="order_orderNo" />
						</p>
						<input class="w-customer" id="orderNO" name="orderNO">
					</div>



					<div class="searchInp clearfix">
						<!-- 订单状态 -->
						<p class="searchTxt">
							<spring:message code="order_status" />
						</p>
						<select id="orderStatusCD" name="orderStatusCD"
							style="width: 150px;">
							<option value="" selected="selected"><spring:message
									code="CompanyUser_pleaseChoose" /></option>
							<c:forEach items="${fns:getDictList(orderStatus)}" var="item">
								<option
									<c:if test="${fn:split(order.orderStatusCD,'-')[1] eq item.itemValue}">selected="selected"</c:if>
									value="${item.itemCode}-${item.itemValue}">
									${item.itemName}</option>
							</c:forEach>
						</select>
					</div>

					<div class="searchInp clearfix">
						<!-- 生产状态 -->
						<p class="searchTxt">
							<spring:message code="production_status" />
						</p>
						<select id="orderProduceStatusCd" name="orderProduceStatusCd"
							style="width: 150px;">
							<option value="" selected="selected"><spring:message
									code="CompanyUser_pleaseChoose" /></option>
							<c:forEach items="${fns:getDictList(productionStatus)}" var="item">
								<option
									<c:if test="${fn:split(order.orderProduceStatusCd,'-')[1] eq item.itemValue}">selected="selected"</c:if>
									value="${item.itemCode}-${item.itemValue}">
									${item.itemName}</option>
							</c:forEach>
						</select>
					</div>
					
					<div class="searchInp clearfix">
						<!-- 裁剪日期 -->
						<p class="searchTxt">
							裁剪日期
						</p>
						<div class="timeBox">
							<input type="text" class="laydate-icon"
								onclick="WdatePicker({el:this,dateFmt:'yyyy-MM-dd',onpicked:null})"
								id="operating3Date" name="operating3Date"
								style="width: 110px" value="<%-- ${fns:getDate('yyyy-MM-dd') } --%>">

						</div>
					</div>
				</div>
				<div class="searchRight searchRightLg">
	            	<c:if test="${order.imageFlag == 'produceLicenceImage' }">
		            	<!-- 返回上一页 -->
		                <button type="button" class="btn-js" style="width: 70px;"  onclick="window.location.href='${ctx}/produce/license/'">返回</button>
	            	</c:if>
					<!-- 重置 -->
					<button type="button" class="btn-js" style="width: 70px;"
						onclick="clean()">
						<spring:message code="common_reset" />
					</button>
					<!-- 检索 -->
					<button type="button" class="btn-js" style="width: 70px;"
						onclick="searchListForm();">
						<spring:message code="commom_check" />
					</button>
				</div>
			</div>
			<form id="personalReport"></form>
			<div class="tableArea">
				<div class="tableScrollSm"
					style="overflow: auto; width: 2135px;height: 710px;">
					<table cellpadding="0" class="tableHead">
						<thead>
							<tr>
								<!-- checkBox 
			                        <th><input type="checkbox"  style="height:auto;" onclick="chooseAll(this)"></th>-->
								<!-- No. -->
								<th><p class="table-No">
										<spring:message code="order_No" />
									</p></th>
								<!-- 订单类型 -->
								<th><p style="width: 100px">
										<spring:message code="contract_orderType" />
									</p></th>
								<!-- 生产号 -->
								<th><p style="width: 140px">
										<spring:message code="style_neibu_no" />
									</p></th>
								<!-- 合同号 -->
								<th><p class="width-140px">
										<spring:message code="contract_no" />
									</p></th>
								<!-- 订单号 -->
								<th><p class="width-140px">
										<spring:message code="order_orderNo" />
									</p></th>
								<!-- 面料号 -->
								<th><p class="width-140px">
										面料号
									</p></th>
								<!-- 订单状态 -->
								<th><p class="width-100px" onclick="orderBy(this,92);">
										<spring:message code="order_status" />
									</p></th>
								<!-- 生产状态 -->
								<th><p class="width-100px" onclick="orderBy(this,313);">
										<spring:message code="production_status" />
									</p></th>
								<c:forEach items="${operatingPList }" var="operate">
									<!-- 工序 -->
									<th class="operiting-${operate.id}"><p class="width-120px" onclick="orderBy(this,${operate.id});">${operate.itemShortNameCn }</p></th>
								</c:forEach>
								<!-- 更新人员 -->
								<th><p class="width-100px">
									<spring:message code="mornitor_update_user" />
								</p></th>
								<!-- 更新日期 -->
								<th><p class="width-100px">
									<spring:message code="mornitor_update_date" />
								</p></th>
								<!-- 裁剪日期 -->
								<th><p class="width-140px">
									裁剪日期
								</p></th>
							</tr>
						</thead>
					</table>
					<table cellpadding="0" class="tableBody">
						<tbody id="listHtml"></tbody>
					</table>
				</div>
			</div>
		</div>
		<div id="paging"></div>
	</div>
	<script>
		$(document).ready(function() {
			//画面区分 
			var imageFlag = "${order.imageFlag}";
			//生产制单画面 
			if (imageFlag == 'produceLicenceImage') {
				searchListForm();
			} 
			$("select").select2();
		});
	</script>
</body>
</html>